package Test1;

import java.net.URL;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Test1 extends JApplet
{
	 public void init ()
	 {
		 Container contentPane = getContentPane();
		 contentPane.setLayout(new BorderLayout());
		 
		 JLabel label = new JLabel(getParameter("greeting"),SwingConstants.CENTER);
		 label.setFont(new Font("Timesroman", Font.BOLD, 18));
		 contentPane.add(label, "Center");
		 
		 JPanel panel = new JPanel();
		 
		 JButton StevenButton = new JButton("Steven");
		 StevenButton.addActionListener(getURLACTIONLISTENER("http://www.ronlynn.com/test"));
		 panel.add(StevenButton); 
		 
		 JButton LinButton = new JButton("Lin");
		 LinButton.addActionListener(getURLACTIONLISTENER("http://www.ronlynn.com/test"));
		 panel.add(LinButton); 
		 		 
		 contentPane.add(panel,"South");
	 }

	public ActionListener getURLACTIONLISTENER(final String urlString) {
		// TODO Auto-generated method stub
		return new 
				ActionListener(){
			public void actionPerformed(ActionEvent evt)
			{
				try
				{
					URL u = new URL(urlString);
					getAppletContext().showDocument(u);
				}
				catch(Exception e) {e.printStackTrace();}
			}
		};
		}
	}
			
